/*! \file
 *      \brief The second user program -
 *             You can add your own code here if you wish.
 */

#include <scwrapper.h>

void draw(int x, int y) {
	static int oldx = 0;
	static int oldy = 0;
	
	printat(y,x, "X");
	printat(oldy,oldx, " ");

	oldx = x;
	oldy = y;
}

void 
main(int argc, char* argv[])
{
	int x = 0; 
	int y = 0;
	int rx = 1;
	int ry = -1;
	
	while(1) {
		
		draw(x,y);

		if ((y >= 24 && ry == 1) || (y <= 0 && ry == -1))	ry *= -1;
		if ((x >= 79 && rx == 1) || (x <= 0 && rx == -1))	rx *= -1;
		
		x += rx;
		y += ry;
		
		pause(20);
	}
}
